Closed
Conversation
Instead of just using regular struct lowering for these types, which results in an incorrect ABI (e.g. returning indirectly), use `BackendRepr::ScalableVector` which will lower to the correct type and be passed in registers. This also enables some simplifications for generating alloca of scalable vectors and greater re-use of `scalable_vector_parts`. A LLVM codegen test demonstrating the changed IR this generates is included in the next commit alongside some intrinsics that make these tuples usable.
Clang changed to representing tuples of scalable vectors as
structs rather than as wide vectors (that is, scalable vector types
where the `N` part of the `<vscale x N x ty>` type was multiplied by
the number of vectors). rustc mirrored this in the initial implementation
of scalable vectors.
Earlier versions of our patches used the wide vector representation and
our intrinsic patches used the legacy
`llvm.aarch64.sve.tuple.{create,get,set}{2,3,4}` intrinsics for creating
these tuples/getting/setting the vectors, which were only supported
due to LLVM's `AutoUpgrade` pass converting these intrinsics into
`llvm.vector.insert`. `AutoUpgrade` only supports these legacy intrinsics
with the wide vector representation.
With the current struct representation, Clang has special handling in
codegen for generating `insertvalue`/`extractvalue` instructions for
these operations, which must be replicated by rustc's codegen for our
intrinsics to use. This patch implements new intrinsics in
`core::intrinsics::scalable` (mirroring the structure of
`core::intrinsics::simd`) which rustc lowers to the appropriate
`insertvalue`/`extractvalue` instructions.
Generate debuginfo for scalable vectors, following the structure that Clang generates for scalable vectors.
Abstract over the existing `simd_cast` intrinsic to implement a new `sve_cast` intrinsic - this is better than allowing scalable vectors to be used with all of the generic `simd_*` intrinsics.
PR rust-lang#154634 recently renamed many type parameters that impl `HashStableContext` as `Hcx`. It missed a few that are named `HirCtx`. This commit renames them.
They're in multiple sections with no rhyme or reason.
`derive(HashStable_Generic)` generates impls like this:
```
impl<__CTX> HashStable<__CTX> for ExpnKind
where
__CTX: crate::HashStableContext
{
fn hash_stable(&self, hcx : &mut __CTX, __hasher: &mut StableHasher) {
...
}
}
```
This is used for crates that are upstream of `rustc_middle`.
The `crate::HashStableContext` bound means every crate that uses
`derive(HashStable_Generic)` must provide (or import) a trait
`HashStableContext` which `rustc_middle` then impls. In `rustc_span`
this trait is sensible, with three methods. In other crates, this trait
is empty, and there is the following trait hierarchy:
```
rustc_session::HashStableContext
| |
| rustc_hir::HashStableContext
| / \
rustc_ast::HashStableContext rustc_abi::HashStableContext
|
rustc_span::HashStableContext
```
All very strange and unnecessary. This commit changes
`derive(HashStable_Generic)` to use `rustc_span::HashStableContext`
instead of `crate::HashStableContext`. This eliminates the need for all
the empty `HashStableContext` traits and impls. Much better.
This annotates the `Arc` type with the diagnostic attribute `#[diagnostic::on_move]`. Now when a moved `Arc` is borrowed, a suggestion to clone it is made, with a label explaining why.
…_attrs` function
…y_macro_source` function
…_macro` function
…middle_region` function
…region_outlives_predicate` function
…proc_macro` function
…f_id_and_parts` function
…field_with_def_id` function
…bound_vars` function
… r=Urgau [rustdoc] Replace `DocContext` with `TyCtxt` wherever possible In a lot of places, we pass down `DocContext` but actually only use its `tcx` field (`TyCtxt`). To make it more obvious what's actually being done, I replaced `DocContext` with `TyCtxt` (which implements `Copy`) in the function arguments. It created quite the cascade effect so I ended up with a lot more changes I expected. Because it's a lot of changes, I made small commits which are easy to go through, so I strongly recommend reviewing this PR one commit at a time. r? @Urgau
Member
Author
This comment has been minimized.
This comment has been minimized.
Contributor
rust-bors bot
pushed a commit
that referenced
this pull request
Apr 2, 2026
Rollup of 11 pull requests try-job: test-various try-job: x86_64-gnu-aux try-job: x86_64-gnu-llvm-21-3 try-job: x86_64-msvc-1 try-job: aarch64-apple try-job: x86_64-mingw-1
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors bot
pushed a commit
that referenced
this pull request
Apr 2, 2026
Rollup of 11 pull requests Successful merges: - #153105 (Compute the result of a projection type with region errors) - #153286 (various fixes for scalable vectors) - #153960 (Make `layout_of` cycles fatal errors) - #154527 (Emit pre-expansion feature gate warnings for negative impls and specialization) - #154666 (Remove `StableHashContext` impls) - #154669 (Introduce #[diagnostic::on_move] on `Arc`) - #154442 (Export `derive` at the crate root: `core::derive` and `std::derive`) - #154644 (rustdoc: seperate methods and associated functions in sidebar) - #154660 (Avoid creating async return opaques for foreign async fns) - #154671 (Add a test for a past ICE when calling a const fn of an unresolved type with the wrong number of args) - #154680 ([rustdoc] Replace `DocContext` with `TyCtxt` wherever possible)
Collaborator
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Contributor
|
💔 Test for 21dbcd2 failed: CI. Failed job:
|
Contributor
|
PR #153286, which is a member of this rollup, was unapproved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
layout_ofcycles fatal errors #153960 (Makelayout_ofcycles fatal errors)StableHashContextimpls #154666 (RemoveStableHashContextimpls)Arc#154669 (Introduce #[diagnostic::on_move] onArc)deriveat the crate root:core::deriveandstd::derive#154442 (Exportderiveat the crate root:core::deriveandstd::derive)DocContextwithTyCtxtwherever possible #154680 ([rustdoc] ReplaceDocContextwithTyCtxtwherever possible)r? @ghost
Create a similar rollup